package com.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.model.ReponseDto;
import com.model.SysAddressLimit;
import com.service.ISysAddressLimitService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping(value = "/coin")
@Api(tags = "开关管理", value = "开关管理相关api")
public class SysAddressLimitController {

    @Autowired
    private ISysAddressLimitService sysAddressLimitService;

    @RequestMapping(value = "/list")
    @ApiOperation(value = "开关列表")
    @ApiImplicitParams({})
    public ReponseDto<List<SysAddressLimit>> list(Model model, HttpServletRequest request) {
        return sysAddressLimitService.list();
    }

    @RequestMapping(value = "/update")
    @ApiOperation(value = "开关操作")
    @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "id", required = true),
            @ApiImplicitParam(name = "type", value = "开关类型0:充值开关,1:内部转币开关,2:提币开关", required = true),
            @ApiImplicitParam(name = "value", value = "值,0:关,1:开", required = true) })
    public ReponseDto<String> update(Model model, HttpServletRequest request, Integer id, Integer type, Integer value,
            @RequestHeader String userId, @RequestHeader String username) {
        return sysAddressLimitService.edit(id, type, value, userId, username);
    }
}
